'use strict';

const Sequelize = require('sequelize');
var sequelize = new Sequelize('demo', 'cdb_outerroot', 'DDLNagijkQ3x', {
    host: '10.66.181.125',
    port: 3306,
    dialect: 'mysql',
    pool: {
        max: 5,
        min: 0,
        idle: 10000
    }
});

module.exports = sequelize;

// test connect
// sequelize
//     .authenticate()
//     .then(function(err) {
//         console.log('Connection has been established successfully.');
//     })
//     .catch(function(err) {
//         console.log('Unable to connect to the database:', err);
//     });

// var User = sequelize.define('user', {
//     firstName: {
//         type: Sequelize.STRING
//     },
//     lastName: {
//         type: Sequelize.STRING
//     }
// });

// // force: true will drop the table if it already exists
// User.sync({ force: false }).then(function() {
//     // Table created
//     return User.create({
//         firstName: 'John',
//         lastName: 'Hancock'
//     });
// });